package com.hsj.pojo;

import java.sql.Timestamp;

/**
 * @author:Teacher黄
 * @date:Created at 2018/11/12
 */
public class User {
    private int id;
    private String userName;
    private long userPhone;
    private String userPwd;
    private Timestamp userAddTime;
    private int roleId;
    /**
     * 一对多的关系配置(多方),用户角色
     */
    private Role role;



    /**
     * 一对一关系配置
     */
    private Address address;


    public User() {
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public long getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(long userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    public Timestamp getUserAddTime() {
        return userAddTime;
    }

    public void setUserAddTime(Timestamp userAddTime) {
        this.userAddTime = userAddTime;
    }

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (id != user.id) return false;
        if (userPhone != user.userPhone) return false;
        if (roleId != user.roleId) return false;
        if (userName != null ? !userName.equals(user.userName) : user.userName != null) return false;
        if (userPwd != null ? !userPwd.equals(user.userPwd) : user.userPwd != null) return false;
        if (userAddTime != null ? !userAddTime.equals(user.userAddTime) : user.userAddTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (int) (userPhone ^ (userPhone >>> 32));
        result = 31 * result + (userPwd != null ? userPwd.hashCode() : 0);
        result = 31 * result + (userAddTime != null ? userAddTime.hashCode() : 0);
        result = 31 * result + roleId;
        return result;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", userPhone=" + userPhone +
                ", userPwd='" + userPwd + '\'' +
                ", userAddTime=" + userAddTime +
                ", roleId=" + roleId +
                ", address=" + address +
                ", role=" + role +
                '}';
    }
}
